package com.jomoo.scs.controller;

import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.jomoo.scs.model.Useraddress;
import com.jomoo.scs.service.UseraddressService;
import com.jomoo.scs.utils.PublicUtils;

@Controller
@RequestMapping("/hello")
public class Test {

	@Autowired
	private UseraddressService useraddressService;
	
	@RequestMapping("/world")
	@ResponseBody
	public String helloWorld(){
		return "helloWorld";
		
	}
	
	@RequestMapping("/getAddress")
	@ResponseBody
	public Object getAddress(){
		HashMap<String, Object> hashMap = new HashMap<>();
		
		List<Useraddress> address = useraddressService.getAddress();
		hashMap.put("list", address);
		hashMap.put("date", PublicUtils.getDateString());
		return hashMap;
		
	}
	
}
